<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Inspire - Admin and Dashboard Template</title>

    <link rel="stylesheet" type="text/css" href="/assets/css/bootstrap.min.css">

    <link rel="stylesheet" type="text/css" href="/assets/fonts/line-icons.css">

    <link rel="stylesheet" type="text/css" href="/assets/css/main.css">

    <link rel="stylesheet" type="text/css" href="/assets/css/responsive.css">
</head>
<body>
<div class="card-header border-bottom">
    <h4 class="card-title">修改密码</h4>
</div>
<div class="msg" th:text="${msg}"></div>
<div class="card-body">
    <div class="row">
        <div class="col-lg-10 col-md-12 col-xs-12">
            <form role="form" id="form-validation" novalidate="novalidate">
                <div class="form-group row">
                    <label class="col-sm-2 col-form-label control-label">原密码</label>
                    <div class="col-sm-9">
                        <input type="password" class="form-control" id="jiup" maxlength="16" >
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 col-form-label control-label">新密码</label>
                    <div class="col-sm-9">
                        <input type="password" class="form-control"  id="password" maxlength="16" >
                    </div>
                </div>
                <div class="form-group row">
                    <label class="col-sm-2 col-form-label control-label">再次输入</label>
                    <div class="col-sm-9">
                        <input type="password" class="form-control" id="queren" maxlength="16" >
                    </div>
                </div>
                <input type="button" class="btn btn-common" id="save" value="修改">
                <input type="button" class="btn btn-common" id="return" value="返回">
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" th:inline="javascript">
$(".msg").slideUp(3000)

    $("#save").bind("click",function () {

        var p = [[${user.password}]]
        var id = [[${user.id}]]

        var jiup = $("#jiup").val()
        var password = $("#password").val()
        var queren = $("#queren").val()

        if(p != jiup){
            alert("原密码输入错误")
            return
        }
        if(password == queren){
            if(!confirm("确定修改吗?")) return
            // $.ajax({
            //     type: "post",
            //     url: "/user/updatePassword",
            //     data: "&id="+id+"&password="+password,
            //     success:function (data) {
            //         alert("回调")
            //         location.href=data.backurl
            //     }
            // })
            location.href="/user/updatePassword?id="+id+"&password="+password
          //  toJump("/user/updatePassword","&id="+id+"&password="+password)

        }else{
           alert("2次密码输入不一致")
            return;
        }
    })

    $("#return").bind("click",function () {
        toJump("/cinema/query")
    })
</script>
<script src="/assets/js/jquery-min.js"></script>
<script src="/assets/js/popper.min.js"></script>
<script src="/assets/js/bootstrap.min.js"></script>
<script src="/assets/js/jquery.app.js"></script>
<script src="/assets/js/main.js"></script>
</body>

</html>